﻿using System.Windows.Forms;
using Spread.Common.Features.Sample;
using GrapeCity.Spreadsheet;
using FarPoint.Win.Spread;

namespace Spread.Calculation.Features
{
  public partial class DynamicArraysDemo : BaseSampleControl
  {
    public DynamicArraysDemo()
    {
      InitializeComponent();
      fpSpread1.AsWorkbook().WorkbookSet.CalculationEngine.CalcFeatures = GrapeCity.Spreadsheet.CalcFeatures.DynamicArray;
      using (System.IO.MemoryStream s = new System.IO.MemoryStream(ExcelTemplates.spilled_array_function_examples))
      {
        bool ret = fpSpread1.OpenExcel(s);
      }
      IWorkbook wb = fpSpread1.AsWorkbook();
      // note: to set a Dynamic Array formula in code that is intended to "spill" you MUST use the new Formula2 property!
      wb.Worksheets["SINGLE"].Range("C8").Formula2 = "{1,2,3,4,5}";
      wb.Worksheets["SINGLE"].Range("B14").Formula2 = "{1;2;3;4;5}";
    }
  }
}


//

//DynamicArraysDemo.Designer.cs

//



namespace Spread.Calculation.Features
{
  partial class DynamicArraysDemo
  {
    /// <summary> 
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.IContainer components = null;

    /// <summary> 
    /// Clean up any resources being used.
    /// </summary>
    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    protected override void Dispose(bool disposing)
    {
      if (disposing && (components != null))
      {
        components.Dispose();
      }
      base.Dispose(disposing);
    }

    #region Component Designer generated code

    /// <summary> 
    /// Required method for Designer support - do not modify 
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DynamicArraysDemo));
      this.splitContainer1 = new System.Windows.Forms.SplitContainer();
      this.splitContainer2 = new System.Windows.Forms.SplitContainer();
      this.nameBox1 = new FarPoint.Win.Spread.NameBox();
      this.panel1 = new System.Windows.Forms.Panel();
      this.formulaTextBox1 = new FarPoint.Win.Spread.FormulaTextBox();
      this.fpSpread1 = new FarPoint.Win.Spread.FpSpread(FarPoint.Win.Spread.LegacyBehaviors.None);
      
      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
      this.splitContainer1.Panel1.SuspendLayout();
      this.splitContainer1.Panel2.SuspendLayout();
      this.splitContainer1.SuspendLayout();
      ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
      this.splitContainer2.Panel1.SuspendLayout();
      this.splitContainer2.Panel2.SuspendLayout();
      this.splitContainer2.SuspendLayout();
      this.panel1.SuspendLayout();
      ((System.ComponentModel.ISupportInitialize)(this.fpSpread1)).BeginInit();
      this.SuspendLayout();
      // 
      // pnlMain
      // 
      this.pnlMain.Size = new System.Drawing.Size(600, 450);
      // 
      // pnlControls
      // 
      this.pnlControls.Size = new System.Drawing.Size(199, 450);
      // 
      // splitContainer1
      // 
      this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
      this.splitContainer1.Location = new System.Drawing.Point(0, 0);
      this.splitContainer1.Name = "splitContainer1";
      this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
      // 
      // splitContainer1.Panel1
      // 
      this.splitContainer1.Panel1.Controls.Add(this.splitContainer2);
      this.splitContainer1.Panel1MinSize = 21;
      // 
      // splitContainer1.Panel2
      // 
      this.splitContainer1.Panel2.Controls.Add(this.fpSpread1);
      this.splitContainer1.Size = new System.Drawing.Size(800, 450);
      this.splitContainer1.SplitterDistance = 25;
      this.splitContainer1.TabIndex = 0;
      // 
      // splitContainer2
      // 
      this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
      this.splitContainer2.Location = new System.Drawing.Point(0, 0);
      this.splitContainer2.Name = "splitContainer2";
      // 
      // splitContainer2.Panel1
      // 
      this.splitContainer2.Panel1.Controls.Add(this.nameBox1);
      // 
      // splitContainer2.Panel2
      // 
      this.splitContainer2.Panel2.Controls.Add(this.panel1);
      this.splitContainer2.Size = new System.Drawing.Size(800, 25);
      this.splitContainer2.SplitterDistance = 266;
      this.splitContainer2.TabIndex = 0;
      // 
      // nameBox1
      // 
      this.nameBox1.Dock = System.Windows.Forms.DockStyle.Fill;
      this.nameBox1.Location = new System.Drawing.Point(0, 0);
      this.nameBox1.MaxLength = 255;
      this.nameBox1.Name = "nameBox1";
      this.nameBox1.Size = new System.Drawing.Size(266, 21);
      this.nameBox1.TabIndex = 0;
      //Attach nameBox1 to fpSpread1
      this.nameBox1.Attach(this.fpSpread1);
      // 
      // panel1
      // 
      this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
      this.panel1.Controls.Add(this.formulaTextBox1);
      this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
      this.panel1.Location = new System.Drawing.Point(0, 0);
      this.panel1.Name = "panel1";
      this.panel1.Size = new System.Drawing.Size(530, 25);
      this.panel1.TabIndex = 0;
      // 
      // formulaTextBox1
      // 
      this.formulaTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
      this.formulaTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
      this.formulaTextBox1.Location = new System.Drawing.Point(0, 0);
      this.formulaTextBox1.Margin = new System.Windows.Forms.Padding(0);
      this.formulaTextBox1.Name = "formulaTextBox1";
      this.formulaTextBox1.Size = new System.Drawing.Size(528, 23);
      this.formulaTextBox1.TabIndex = 1;
      //Attach formulaTextBox1 to fpSpread1
      this.formulaTextBox1.Attach(this.fpSpread1);
      // 
      // fpSpread1
      // 
      this.fpSpread1.AccessibleDescription = "fpSpread1, Sheet1, Row 0, Column 0";
      this.fpSpread1.Dock = System.Windows.Forms.DockStyle.Fill;
      this.fpSpread1.Font = new System.Drawing.Font("Calibri", 11F);
      this.fpSpread1.Location = new System.Drawing.Point(0, 0);
      this.fpSpread1.Margin = new System.Windows.Forms.Padding(2);
      this.fpSpread1.Name = "fpSpread1";
      this.fpSpread1.Size = new System.Drawing.Size(800, 421);
      this.fpSpread1.TabIndex = 0;
      // 
      // DynamicArraysDemo
      // 
      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
      this.Controls.Add(this.splitContainer1);
      this.Name = "Dynamic Arrays";
      this.Size = new System.Drawing.Size(800, 450);
      this.Controls.SetChildIndex(this.splitContainer1, 0);
      this.splitContainer1.Panel1.ResumeLayout(false);
      this.splitContainer1.Panel2.ResumeLayout(false);
      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
      this.splitContainer1.ResumeLayout(false);
      this.splitContainer2.Panel1.ResumeLayout(false);
      this.splitContainer2.Panel2.ResumeLayout(false);
      ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
      this.splitContainer2.ResumeLayout(false);
      this.panel1.ResumeLayout(false);
      ((System.ComponentModel.ISupportInitialize)(this.fpSpread1)).EndInit();
      this.ResumeLayout(false);

    }

    #endregion

    private System.Windows.Forms.SplitContainer splitContainer1;
    private System.Windows.Forms.SplitContainer splitContainer2;
    private FarPoint.Win.Spread.NameBox nameBox1;
    private System.Windows.Forms.Panel panel1;
    private FarPoint.Win.Spread.FormulaTextBox formulaTextBox1;
    private FarPoint.Win.Spread.FpSpread fpSpread1;
  }
}
